// 类 {Class}
// 修饰符


export {}

class Person {
    public name: string // 默认为public
    private age: number // 私有属性
    protected gender: boolean // 受保护的属性 只允许在子类中访问

    constructor(name: string, age: number) {
        this.name = name
        this.age = age
        this.gender = true
    }

    sayHi(msg: string): void {
        console.log('dd')
    }
}

class Student extends Person {
    private constructor(name: string, age: number) {
        super(name, age)
        console.log(this.gender)
    }

    static create(name: string, age: number) {
        return new Student(name, age)
    }
}

const tom = new Person('tom', 18)
console.log(tom.name)
// console.log(tom.age)
// console.log(tom.gender)

const stu = Student.create('tom1', 89);